package com.titan.demo.ConfigBySpring.consumer;

import java.util.List;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.titan.demo.common.dao.User;
import com.titan.demo.common.interfaces.IDemoService;

public class Consumer {

	public static void main(String[] args) throws Exception {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { "com/titan/demo/ConfigBySpring/consumer/config/applicationContext.xml" });
		context.start();

		IDemoService demoService = (IDemoService) context.getBean("demoService"); //
		String hello = demoService.sayHello("tom"); // ִ
		System.out.println(hello); //

		//
		List<User> list = demoService.getUsers();
		if (list != null && list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				System.out.println(list.get(i));
			}
		}
	}

}